package com.hdq.mapper;

import com.github.pagehelper.Page;
import com.hdq.annotation.AutoFill;
import com.hdq.annotation.AutoFillList;
import com.hdq.enumeration.OperationType;
import dto.ImageEditDTO;
import entity.Image;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ImageMapper {

//    插入图片数据
    @AutoFillList(value = OperationType.INSERT)
    void insertPictureByCategory(List<Image> imageList);

    @Select("select * from image where image_class_id = #{imageId}")
    Page<Image> getImageByCategory(Long imageId);

    @Delete("delete from image where id = #{id}")
    void deleteImage(Integer id);

    @Update("update image set name = #{name} where id = #{id}")
    @AutoFill(OperationType.UPDATE)
    void updateImage(ImageEditDTO imageEditDTO);
}
